package com.zr.daoimpl;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.zr.dao.ShowJianPriceDao;
import com.zr.model.CharTrap;
@Repository("shjiprdi")
public class ShowJianPriceDaoImpl<T> extends BaseDaoImpl<T> implements ShowJianPriceDao<T>{

	@Override
	public List<CharTrap> findJianPrice(int page, int rows) {
		
		String hql="from CharTrap";
		//Query query=this.getSessionFactory().openSession().createQuery(hql);
		Query query=this.getCurrentSession().createQuery(hql);
		query.setFirstResult((page-1)*rows);
		query.setMaxResults(rows);
		List<CharTrap> li=query.list();		
		return li;
	}

	@Override
	public Integer getcoun() {
		
		String hql="select count(t.tpid) from Ctrapri as t";
		Query query=this.getSessionFactory().openSession().createQuery(hql);
		int count = ((Number)query.uniqueResult()).intValue();
		//Integer i=(Integer) query.uniqueResult();
		
		return count;
	}

}
